<?php
require_once('../../libraryfiles/config.php');
$include = '
<link rel="stylesheet" href="'.W_ROOT.'/css/admin_style.css" />
<script type="text/javascript" src="'.W_ROOT.'/js/action.js"></script>
<script type="text/javascript" src="'.W_ROOT.'/js/common.js"></script>
<script type="text/javascript" src="'.W_ROOT.'/js/jquery.js"></script>
<script type="text/javascript" src="'.W_ROOT.'/libraryfiles/js_global.php"></script>

<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.9.1.js"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">	
';

$view = (isset($_GET['view'])) ? $_GET['view'] : '';
switch($view){
	case'add':
	$site_title = "Administrator Site - Add New Account";
	$content = 'add.php';
	break;
	
	case 'publish' :
	if (isset($_GET['id']) && (int)$_GET['id'] > 0) {
		$id = (int)$_GET['id'];
	} else {
		header('Location: index.php');
		exit();
	}
	
	if(isset($_GET['publish']) && (int)$_GET['publish']>=0 && (int)$_GET['publish']<=1){
		$publish = (int)$_GET['publish'];

	}
	 else {
		header('Location: index.php');
		exit();
	}
	
	//Statement to publish/unpublish User
	publish('tbluser_account_type',$publish,$id);
	
	header("Location: index.php?".getAllGetParams(array('view','id','publish')));
	exit();
	break;
	
	case 'delete':
	if (isset($_GET['id']) && (int)$_GET['id'] > 0) {
		$id = (int)$_GET['id'];
	} else {
		header('Location: index.php');
		exit();
	}
	$sql = "DELETE FROM tbluser_account_type WHERE id = $id";
	mysql_query($sql);
	header("Location: index.php?".getAllGetParams(array('view','id','publish')));
	exit;
	break;
		
	default:
	$site_title = "Administrator Site - Account Type";
	$content = 'list.php';
	break;
}

require_once TMP_ADMIN_PATH;
?>

